﻿using UnityEngine;
using System.Collections;

public abstract class Weapon : MonoBehaviour
{
    bool canBurst;
    float coldTime;
    float damage;
    float reloadTime;
    int ammoNumMax;
    int ammoNumRemain;
    WeaponPlugin pluginFirst;
    WeaponPlugin pluginSecond;
    Vector3 weaponDirection;

    public bool CanBurst
    {
        get
        {
            return canBurst;
        }
    }

    public abstract void fire(int playerStr);

    public void calDamage()
    {
        
    }

    public abstract void reload();

    public void checkWeaponPlugin()
    {
        pluginFirst.preEffect();
        pluginSecond.preEffect();
    }

    public void addFirstPlugin(WeaponPlugin plugin)
    {
        this.pluginFirst = plugin;
    }

    public void addSecondPlugin(WeaponPlugin plugin)
    {
        this.pluginSecond = plugin;
    }

    public void updateDirection()
    {
        Vector3 playerMousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        weaponDirection = playerMousePosition - transform.position;
        transform.Rotate(0,0,Mathf.Atan(weaponDirection.y / weaponDirection.x));

    }
}
